package com.hxx.controller;

import com.hxx.domain.TProduct;
import com.hxx.service.ProuctFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ProductController {
    @Autowired
    private ProuctFeign prouctFeign;

    @GetMapping("/show5/{name}")
    public String show5(@PathVariable String name){
        return prouctFeign.show5(name);
    }

    @GetMapping("/show6")
    public String show6(){
        return prouctFeign.show6(List.of(1,2,3,4,5,6,7,8,9,10)).toString();
    }


    @GetMapping("/show4")
    public String getProduct(TProduct product){
        return prouctFeign.show4(product);
    }


   @GetMapping("/{id}")
    public String getProduct(@PathVariable Integer id){
       TProduct product = prouctFeign.getProduct(id);
       return product.toString();
   }

   @GetMapping("/show2/{name}/{age}")
   public String show2(@PathVariable String name,@PathVariable int age){
       return prouctFeign.show2(name,age);
   }

   @GetMapping("/show")
    public String show(){
       return prouctFeign.show();
   }

   @GetMapping("/show1/{name}")
    public String show1(@PathVariable String name){
       return prouctFeign.show1(name);
   }

}
